package com.gyj.Test.Other;

import com.google.common.base.Joiner;
import com.sun.deploy.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by Gao on 2018/5/12.
 */
public class ListToString {

    private static String ListToString() {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        String str = Joiner.on(",").join(list);
        String str1 = StringUtils.join(list, ",");
        System.out.println(str);
        System.out.println(str1);
        return str;
    }

    private static List<String> StringToList() {
        String str = "a,b,c";
        List<String> list = Arrays.asList(str.split(","));
        System.out.println(list);

        String str1 = "a,b,c";
        List<String> result = Arrays.asList(StringUtils.splitString(str1,","));
        System.out.println(result);
        return list;
    }

    public static void main(String[] args) {
        ListToString();

        StringToList();
    }
}

/**
 a,b,c
 a,b,c
 [a, b, c]
 [a, b, c]
 */